import 'package:flutter/material.dart';
import './db_helper.dart';

import 'info_button.dart';

class ParticipleTest extends StatefulWidget {
  const ParticipleTest({super.key});

  @override
  State<ParticipleTest> createState() => _ParticipleTestState();
}

class _ParticipleTestState extends State<ParticipleTest> {
  String? _participleResult;
  @override
  void initState() {
    super.initState();
  }

  ///分词器测试
  Widget _participleWidget() {
    return InfoButton(
        title: "分词器测试",
        info: _participleResult,
        onTap: () async {
          final maps = await DBHelper().setupDatabase();
          setState(() {
            _participleResult = maps.map((map) => map.toString()).join("\n");
          });
        });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text("分词器测试"),
      ),
      body: ListView(
        children: [
          //查询数据
          _participleWidget(),
        ],
      ),
    );
  }
}
